<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../libs/vue.js"></script>
</head>
<body>
    <div id="app">
        <h3>用户信息</h3>
        <div>
            用户名：<input type="text" v-model="userInfo.username">
        </div>
        <div>
            密码：<input type="password" v-model="userInfo.password">
        </div>
        <div>
            性别：
            <input type="radio" value="male" v-model="userInfo.sex"> 男
            <input type="radio" value="female" v-model="userInfo.sex"> 女
        </div>
        <div>
            爱好：
            <input type="checkbox" value="code" v-model="userInfo.hobby"> 敲代码
            <input type="checkbox" value="sleep" v-model="userInfo.hobby"> 睡觉
            <input type="checkbox" value="playGame" v-model="userInfo.hobby"> 玩游戏
        </div>
        <div>
            所属省：
            <select v-model="userInfo.province">
                <option value="BJ">北京</option>
                <option value="HN">湖南</option>
                <option value="SC">四川</option>
                <option value="GD">广东</option>
            </select>
        </div>
        <div>
            <button @click="submit">点击提交</button>
        </div>
    </div>
    <script>
        let vm = new Vue({
            el:'#app',
            data:{
                userInfo:{
                    username:'admin',
                    password:'123456',
                    sex:'female',
                    hobby:['sleep','playGame'],
                    province:'HN'
                }
            },
            methods: {
                submit(){
                    console.log(this.userInfo)
                    // ajax请求
                }
            },
        })
    </script>
</body>
</html>